package entity;

import loadsave.LoadSaveable;
import loadsave.Memento;
import loadsave.loadsaveobject.LoadSaveObject;
import loadsave.loadsaveobject.LoadSaveObjectComposite;
import loadsave.loadsaveobject.LoadSavePrimitive;

public class Event implements LoadSaveable {
	private String id;
	
	public Event() {
		id = null;
	}
	public Event(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}
	@Override
	public Memento getMemento() {
		return new Memento() {

			@Override
			public LoadSaveObject getState() {
				LoadSaveObjectComposite toReturn = new LoadSaveObjectComposite("", "Event");
				toReturn.add("id", new LoadSavePrimitive("id", "String", id));
				return toReturn;
			}

			@Override
			public void restoreState(LoadSaveObject lso) {
				id = lso.get("id").getValue();
			}
			
		};
	}
}
